Skip to content

Well-balanced mortars for ShallowWaterMultiLayerEquations2D#102

Merged
andrewwinters5000 merged 38 commits intotrixi-framework:mainfrom
andrewwinters5000:multilayer-mortars
May 21, 2025
Merged

Well-balanced mortars for ShallowWaterMultiLayerEquations2D#102
andrewwinters5000 merged 38 commits intotrixi-framework:mainfrom
andrewwinters5000:multilayer-mortars

Conversation

@andrewwinters5000
Copy link
Copy Markdown
Member

This PR adds a specialized prolong2mortars! function to project the solution at the mortars while maintaining well-balancedness for the ShallowWaterMultiLayerEquations2D. The remaining computation and backprojection of the mortar fluxes uses the standard mortar approach from Trixi via calc_mortar_fluxes! and mortar_fluxes_to_elements!. Also, because of the reformulation done in the multilayer equation, the original P4estMortarContainers can be used.

The strategy in this PR is much simpler because the multilayer equations "peel off" the pressure contribution and put it into the nonconservative term for easier well-balancing via hydrostatic reconstruction. So there is no need to carry the unprojected parent solution on the mortars as was necessary in #45. The approach herein is also much less sensitive to the threshold_desingularization.

In testing this new feature it is actually the case that for fully wet flows (or regions of the domain) the standard mortar approach for prolong2mortars! remains well-balanced as well. This solves the conservation issues encountered in #45 .

@andrewwinters5000 andrewwinters5000 added the enhancement New feature or request label May 16, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented May 16, 2025

Codecov Report

Attention: Patch coverage is 98.87640% with 2 lines in your changes missing coverage. Please review.

Project coverage is 99.17%. Comparing base (891417c) to head (b94b73d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/solvers/dgsem_p4est/dg_2d.jl 95.74% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
- Coverage   99.19%   99.17%   -0.02%     
==========================================
  Files          73       77       +4     
  Lines        3459     3635     +176     
==========================================
+ Hits         3431     3605     +174     
- Misses         28       30       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@patrickersing patrickersing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is very nice that you were able to extend this strategy to the MLSWE (with a single layer for now) so easily and that this version requires much less fixes to remain stable / well-balanced in the wet/dry region.
I have a few questions about desingularization & thresholds and added some suggestions to simplify the syntax in the elixirs.

Comment on lines +297 to +298
# Note, no desingularization or water height cutoff is needed here as these steps are done
# later in the hydrostatic reconstruction and stage limiter, respectively.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hydrostatic reconstruction only sets the velocity to zero for dry states, but does not apply the desingularization procedure, so it could still be helpful do apply the desingularization step here.
Did you observe any difference with/without the desingularization step?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I can recall, the WB with wet/dry works the same in either case. I can try the stress test with AMR again to see if there is any benefit to the conservation loss. I never tried it with the desingularized mortars for the Monai or three mound test cases.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After more experimentation I have expanded the comment above this computation to explain the strategy of neither using the max cutoff a la Benov et al. nor the desingularization. Done in f0384fb

andrewwinters5000 and others added 2 commits May 19, 2025 19:44
Co-authored-by: Patrick Ersing <114223904+patrickersing@users.noreply.github.com>
@andrewwinters5000
Copy link
Copy Markdown
Member Author

I cannot work out why the formatting check is failing. I ran the utils/trixisw-format-file.jl on examples/p4est_2d_dgsem/elixir_shallowwater_multilayer_monai_flood_amr.jl and it locally reported no issues.

@JoshuaLampert
Copy link
Copy Markdown
Member

I cannot work out why the formatting check is failing. I ran the utils/trixisw-format-file.jl on examples/p4est_2d_dgsem/elixir_shallowwater_multilayer_monai_flood_amr.jl and it locally reported no issues.

But the issue is with docs/src/tutorials/elixir_shallowwater_monai_tsunami.jl, cf. https://github.com/trixi-framework/TrixiShallowWater.jl/actions/runs/15146079177/job/42581975707?pr=102#step:3:304.

@andrewwinters5000
Copy link
Copy Markdown
Member Author

I cannot work out why the formatting check is failing. I ran the utils/trixisw-format-file.jl on examples/p4est_2d_dgsem/elixir_shallowwater_multilayer_monai_flood_amr.jl and it locally reported no issues.

But the issue is with docs/src/tutorials/elixir_shallowwater_monai_tsunami.jl, cf. https://github.com/trixi-framework/TrixiShallowWater.jl/actions/runs/15146079177/job/42581975707?pr=102#step:3:304.

Whoops, my bad. I saw "monai" and assumed it was the new elixir! I will fix this.

Copy link
Copy Markdown
Member

@patrickersing patrickersing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I would say the small coverage drop is okay, since there is no easy way to create a unit test for the new error exception.

@andrewwinters5000 andrewwinters5000 merged commit ae36086 into trixi-framework:main May 21, 2025
18 of 21 checks passed
@andrewwinters5000 andrewwinters5000 deleted the multilayer-mortars branch May 21, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants